home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / skydiver.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  3KB  |  138 lines

  1. /***************************************************************************
  2.  
  3.   vidhrdw.c
  4.  
  5.     Functions to emulate the video hardware of the machine.
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12. static int skydiver_lamps[8];
  13. static int skydiver_width = 0;
  14.  
  15. WRITE_HANDLER( skydiver_width_w )
  16. {
  17.     skydiver_width = offset;
  18.     logerror("width: %02x\n", data);
  19. }
  20.  
  21. WRITE_HANDLER( skydiver_sk_lamps_w )
  22. {
  23.     switch (offset)
  24.     {
  25.         case 0:    skydiver_lamps[0] = 0;    break;
  26.         case 1:    skydiver_lamps[0] = 1;    break;    /* S */
  27.         case 2:    skydiver_lamps[1] = 0;    break;
  28.         case 3:    skydiver_lamps[1] = 1;    break;    /* K */
  29.     }
  30. }
  31.  
  32. WRITE_HANDLER( skydiver_yd_lamps_w )
  33. {
  34.     switch (offset)
  35.     {
  36.         case 0:    skydiver_lamps[2] = 0;    break;
  37.         case 1:    skydiver_lamps[2] = 1;    break;    /* Y */
  38.         case 2:    skydiver_lamps[3] = 0;    break;
  39.         case 3:    skydiver_lamps[3] = 1;    break;    /* D */
  40.     }
  41. }
  42.  
  43. WRITE_HANDLER( skydiver_iver_lamps_w )
  44. {
  45.     switch (offset)
  46.     {
  47.         case 0:    skydiver_lamps[4] = 0;    break;
  48.         case 1:    skydiver_lamps[4] = 1;    break;    /* I */
  49.         case 2:    skydiver_lamps[5] = 0;    break;
  50.         case 3:    skydiver_lamps[5] = 1;    break;    /* V */
  51.         case 4:    skydiver_lamps[6] = 0;    break;
  52.         case 5:    skydiver_lamps[6] = 1;    break;    /* E */
  53.         case 6:    skydiver_lamps[7] = 0;    break;
  54.         case 7:    skydiver_lamps[7] = 1;    break;    /* R */
  55.     }
  56. }
  57.  
  58. /***************************************************************************
  59.  
  60.   Draw the game screen in the given osd_bitmap.
  61.   Do NOT call osd_update_display() from this function, it will be called by
  62.   the main emulation engine.
  63.  
  64. ***************************************************************************/
  65. void skydiver_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
  66. {
  67.     int offs;
  68.     int pic;
  69.  
  70.     /* for every character in the Video RAM, check if it has been modified */
  71.     /* since last time and update it accordingly. */
  72.     for (offs = videoram_size - 1;offs >= 0;offs--)
  73.     {
  74.         if (dirtybuffer[offs])
  75.         {
  76.             int charcode;
  77.             int color;
  78.             int sx,sy;
  79.  
  80.             dirtybuffer[offs]=0;
  81.  
  82.             charcode = videoram[offs] & 0x3F;
  83.             color    = (videoram[offs] & 0xc0) >> 6;
  84.  
  85.             sx = 8 * (offs % 32);
  86.             sy = 8 * (offs / 32);
  87.             drawgfx(tmpbitmap,Machine->gfx[0],
  88.                 charcode, color,
  89.                 0,0,sx,sy,
  90.                 &Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  91.         }
  92.     }
  93.  
  94.     /* copy the character mapped graphics */
  95.     copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  96.  
  97.     /* Draw "SKYDIVER" lights? */
  98.     {
  99.         int light;
  100.  
  101.         for (light = 0; light < 8; light++)
  102.         {
  103.             char *text = "SKYDIVER";
  104.  
  105.             drawgfx(bitmap,Machine->gfx[0],
  106.                 text[light], skydiver_lamps[light] + 4,
  107.                 0,0,light*8,28*8,
  108.                 &Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  109.         }
  110.     }
  111.  
  112.  
  113.     /* Draw each one of our four motion objects */
  114.     for (pic=3;pic>=0;pic--)
  115.     {
  116.         int sx,sy;
  117.         int charcode;
  118.         int xflip, yflip;
  119.         int color;
  120.  
  121.         sx = 29*8 - spriteram[pic];
  122.         sy = 30*8 - spriteram[pic*2 + 8];
  123.         charcode = spriteram[pic*2 + 9];
  124.         xflip = (charcode & 0x10) >> 4;
  125.         yflip = (charcode & 0x08) >> 3;
  126.         charcode = (charcode & 0x07) | ((charcode & 0x60) >> 2);
  127.         color = pic & 0x01;
  128.  
  129.         drawgfx(bitmap,Machine->gfx[1+(charcode >= 0x10)],
  130.             charcode, color,
  131.             xflip,yflip,sx,sy,
  132.             &Machine->drv->visible_area,TRANSPARENCY_PEN,0);
  133.  
  134.     }
  135. }
  136.  
  137.  
  138.